<?php

namespace App\Services;
require ROOT_PATH.'/app/Common/Ocr/AipOcr.php';

/**
 * 文字识别服务
 * Class OCRService
 * @package App\Services
 */
class OCRService extends BaseService
{
    /**
     * 识别图片文字
     * @param $imgPath
     * @return array
     * @throws
     */
    public static function scan($imgPath)
    {
        $baiduConfig = ConfigService::getSysValueByType('32');
        $client = new \AipOcr($baiduConfig['appid'], $baiduConfig['appkey'], $baiduConfig['appsecret']);
        $image = file_get_contents($imgPath);
        return $client->basicGeneral($image);
    }
}